<!DOCTYPE html>



  


<html class="theme-next muse use-motion" lang="zh-CN">
<head><meta name="generator" content="Hexo 3.9.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">
















  
  
  <link href="/blog/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css">







<link href="/blog/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css">

<link href="/blog/css/main.css?v=5.1.4" rel="stylesheet" type="text/css">


  <link rel="apple-touch-icon" sizes="180x180" href="/blog/images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/blog/images/favicon-32x32-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/blog/images/favicon-16x16-next.png?v=5.1.4">


  <link rel="mask-icon" href="/blog/images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="Hexo, NexT">










<meta name="description" content="在我们的交易系统中，都是以订单为载体，通过客户和商家的操作来决定订单节点的流转，同时决定着下一步该做哪些操作，简单画个图来看一下。  我们可以看到，在每一个动作之后都需要将订单同步到订单索引，同时，在特定节点的时候，还需要通知第三方平台做相应的操作。（这里只是个简单的流程图，实际的流程比这个要复杂很多） 在没使用到监听器模式之前，代码是这样的 123456789101112131415161718">
<meta property="og:type" content="article">
<meta property="og:title" content="使用观察者模式优化代码">
<meta property="og:url" content="https://arrycoder.gitee.io/设计模式/使用观察者模式优化代码/index.html">
<meta property="og:site_name" content="arry&#39;s blog">
<meta property="og:description" content="在我们的交易系统中，都是以订单为载体，通过客户和商家的操作来决定订单节点的流转，同时决定着下一步该做哪些操作，简单画个图来看一下。  我们可以看到，在每一个动作之后都需要将订单同步到订单索引，同时，在特定节点的时候，还需要通知第三方平台做相应的操作。（这里只是个简单的流程图，实际的流程比这个要复杂很多） 在没使用到监听器模式之前，代码是这样的 123456789101112131415161718">
<meta property="og:locale" content="zh-CN">
<meta property="og:image" content="https://arrycoder.gitee.io/blog/设计模式/使用观察者模式优化代码/%E8%AE%A2%E5%8D%95%E6%B5%81%E7%A8%8B.jpg">
<meta property="og:updated_time" content="2020-04-13T07:30:47.105Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="使用观察者模式优化代码">
<meta name="twitter:description" content="在我们的交易系统中，都是以订单为载体，通过客户和商家的操作来决定订单节点的流转，同时决定着下一步该做哪些操作，简单画个图来看一下。  我们可以看到，在每一个动作之后都需要将订单同步到订单索引，同时，在特定节点的时候，还需要通知第三方平台做相应的操作。（这里只是个简单的流程图，实际的流程比这个要复杂很多） 在没使用到监听器模式之前，代码是这样的 123456789101112131415161718">
<meta name="twitter:image" content="https://arrycoder.gitee.io/blog/设计模式/使用观察者模式优化代码/%E8%AE%A2%E5%8D%95%E6%B5%81%E7%A8%8B.jpg">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/blog/',
    scheme: 'Muse',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: 'Author'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="https://arrycoder.gitee.io/设计模式/使用观察者模式优化代码/">





  <title>使用观察者模式优化代码 | arry's blog</title>
  





  <script type="text/javascript">
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?97f9adfda8d04eb91dd054a98264d191";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>




</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-CN">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/blog/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">arry's blog</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/blog/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br>
            
            Home
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/blog/tags/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br>
            
            Tags
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/blog/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br>
            
            Categories
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/blog/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br>
            
            Archives
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://arrycoder.gitee.io/blog/设计模式/使用观察者模式优化代码/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="arry">
      <meta itemprop="description" content>
      <meta itemprop="image" content="/blog/uploads/avatar.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="arry's blog">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">使用观察者模式优化代码</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">Posted on</span>
              
              <time title="Post created" itemprop="dateCreated datePublished" datetime="2020-04-10T10:23:53+08:00">
                2020-04-10
              </time>
            

            

            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <p>在我们的交易系统中，都是以订单为载体，通过客户和商家的操作来决定订单节点的流转，同时决定着下一步该做哪些操作，简单画个图来看一下。</p>
<p><img src="/blog/设计模式/使用观察者模式优化代码/%E8%AE%A2%E5%8D%95%E6%B5%81%E7%A8%8B.jpg" alt="订单流程图"></p>
<p>我们可以看到，在每一个动作之后都需要将订单同步到订单索引，同时，在特定节点的时候，还需要通知第三方平台做相应的操作。（这里只是个简单的流程图，实际的流程比这个要复杂很多）</p>
<p>在没使用到监听器模式之前，<em>代码是这样的</em></p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">createOrder</span><span class="params">()</span> </span>&#123;</span><br><span class="line">  check()</span><br><span class="line">  ···</span><br><span class="line">  ···创建订单流程</span><br><span class="line">  ···</span><br><span class="line">  <span class="comment">// 索引消息发送</span></span><br><span class="line">  indexProducer.send(order);</span><br><span class="line">  <span class="comment">// 通知销售有人下单</span></span><br><span class="line">  messageCenter.send(order);</span><br><span class="line">  <span class="comment">// 创建支付单</span></span><br><span class="line">  payTransactionProducer.send(tran);</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">pay</span><span class="params">()</span> </span>&#123;</span><br><span class="line">  check()</span><br><span class="line">  ···</span><br><span class="line">  ···创建订单流程</span><br><span class="line">  ···</span><br><span class="line">  <span class="comment">// 索引消息发送</span></span><br><span class="line">  indexProducer.send(order);</span><br><span class="line">  <span class="comment">// 通知销售已支付，去发货</span></span><br><span class="line">  messageCenter.send(order);</span><br><span class="line">	<span class="comment">// 创建物流单</span></span><br><span class="line">  logisticsOrderProducer.send(logistic);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>这样的代码就会产生几个问题：</p>
<ol>
<li><p>代码冗余</p>
<p>这个不必说了，每次状态变更都需要调用相同的代码，不仅写起来不够优雅，当你发送消息的参数改动的时候，也需要一个一个地方去修正，很浪费时间。</p>
</li>
<li><p>不利于扩展</p>
<p>产品说：“为了打入商户内部，我们要接入商户现有ERP系统，现在给👴把订单同步过去”。好了，这下，你又需要在每一个节点中加同步的方法，不仅麻烦，还容易出错。</p>
</li>
</ol>
<h2 id="观察者模式"><a href="#观察者模式" class="headerlink" title="观察者模式"></a>观察者模式</h2><p>本篇的重点不在于观察者模式，而在于优化代码。所以关于观察者模式就不介绍了。这里仅放个定义</p>
<blockquote>
<p>观察者模式(Observer Pattern)：定义对象之间的一种一对多依赖关系，使得每当一个对象状态发生改变时，其相关依赖对象皆得到通知并被自动更新。观察者模式的别名包括发布-订阅（Publish/Subscribe）模式、模型-视图（Model/View）模式、源-监听器（Source/Listener）模式或从属者（Dependents）模式。观察者模式是一种对象行为型模式。</p>
</blockquote>
<p>参考资料-&gt; <a href="https://blog.csdn.net/lovelion/article/details/17517213" title="设计模式" target="_blank" rel="noopener">设计模式</a></p>
<h2 id="Spring-EventListener"><a href="#Spring-EventListener" class="headerlink" title="Spring EventListener"></a>Spring EventListener</h2><p>Spring在4.2之后提供了基于注解的事件监听器，我们可以在任意被管理的bean下，使用 <strong>@EventListener</strong>注册监听器，使用ApplicationContext来发布事件。下面看下改造流程。</p>
<ol>
<li>定义一个订单事件,orderCode代表订单号，eventType代表事件类型。</li>
</ol>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">@Getter</span></span><br><span class="line"><span class="meta">@Setter</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">OrderEvent</span> <span class="keyword">extends</span> <span class="title">ApplicationEvent</span> </span>&#123;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">private</span> Order order;</span><br><span class="line"></span><br><span class="line">   <span class="keyword">private</span> EventType eventType;</span><br><span class="line">   <span class="keyword">public</span> <span class="keyword">enum</span> EventType &#123;</span><br><span class="line"></span><br><span class="line">        <span class="comment">// 创建</span></span><br><span class="line">        CREATE,</span><br><span class="line">        <span class="comment">// 支付</span></span><br><span class="line">        PAY,</span><br><span class="line">				<span class="comment">// 确认收货</span></span><br><span class="line">        CONFIRM</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<ol start="2">
<li><p>创建事件监听器</p>
<p>通用的监听器</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">OrderIndexListener</span> </span>&#123;</span><br><span class="line"></span><br><span class="line">    <span class="meta">@Autowired</span></span><br><span class="line">    <span class="keyword">private</span> IndexProducer indexProducer;</span><br><span class="line"></span><br><span class="line">    <span class="comment">//这个注解支持监听器异步执行，可根据需要选择</span></span><br><span class="line">    <span class="meta">@Async</span></span><br><span class="line">    <span class="meta">@EventListener</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">handlerOrderEvent</span><span class="params">(OrderEvent orderEvent)</span> </span>&#123;</span><br><span class="line">        <span class="comment">// 索引消息发送</span></span><br><span class="line">  			indexProducer.send(orderEvent.getOrder());</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>收银台监听器</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">OrderIndexListener</span> </span>&#123;</span><br><span class="line"></span><br><span class="line">    <span class="meta">@Autowired</span></span><br><span class="line">    <span class="keyword">private</span> PaymentOrderProducer paymentOrderProducer;</span><br><span class="line"></span><br><span class="line">    <span class="meta">@Async</span></span><br><span class="line">    <span class="meta">@EventListener</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">handlerPay</span><span class="params">(OrderEvent orderEvent)</span> </span>&#123;</span><br><span class="line">      <span class="comment">// 特殊节点发送</span></span><br><span class="line">      <span class="keyword">if</span>(OrderEvent.EventType.CREATE.equals(orderEvent.getEventType())) &#123;</span><br><span class="line">        paymentOrderProducer.send(orderEvent.getOrder());</span><br><span class="line">      &#125;	</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
</li>
<li><p>改造原来的代码</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"><span class="meta">@Autowired</span></span><br><span class="line"><span class="keyword">private</span> ApplicationContext applicationContext;</span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">createOrder</span><span class="params">(Order order)</span> </span>&#123;</span><br><span class="line">  check()</span><br><span class="line">  ···</span><br><span class="line">  ···创建订单流程</span><br><span class="line">  ···</span><br><span class="line">  applicationContext.publish(<span class="keyword">new</span> OrderEvent(CREATE, order));</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">pay</span><span class="params">()</span> </span>&#123;</span><br><span class="line">  check()</span><br><span class="line">  ···</span><br><span class="line">  ···创建订单流程</span><br><span class="line">  ···</span><br><span class="line">  applicationContext.publish(<span class="keyword">new</span> OrderEvent(CREATE, order));</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

</li>
</ol>
<p>至此，改造已经完成。我们已经解决了之前那种写法里存在的问题，解藕了消息通知等工作，使得业务流程更加清晰，也更容易维护。</p>
<h2 id="需要避过的坑"><a href="#需要避过的坑" class="headerlink" title="需要避过的坑"></a>需要避过的坑</h2><ol>
<li><p>避免循环依赖</p>
<p>监听器和被观察者如果互相依赖，有可能会导致循环调用。最后导致系统崩溃</p>
</li>
<li><p>异步导致的调用乱序</p>
<p>如果使用了异步监听器，要注意给不同监听器加上@Order注解来保证调用不会乱序而影响订单流程。</p>
<p>如果有一些操作，比如设置了0元订单无需支付，直接从 “下单-&gt;待发货”，那么监听器会在很短时间内发送两条同步订单索引的消息，有可能会导致消费者收到消息的顺序是乱的，需要我们做额外的保证，例如延时发送，抛弃旧消息等等。</p>
</li>
<li><p>待扩展…</p>
</li>
</ol>

      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/blog/Spring/SpringBoot-2/" rel="next" title="SpringBoot自动注册">
                <i class="fa fa-chevron-left"></i> SpringBoot自动注册
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/blog/git/概念解释/" rel="prev" title="git概念">
                git概念 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            Table of Contents
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            Overview
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image" src="/blog/uploads/avatar.jpg" alt="arry">
            
              <p class="site-author-name" itemprop="name">arry</p>
              <p class="site-description motion-element" itemprop="description">Java源码/设计模式/个人记录</p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/blog/archives/">
              
                  <span class="site-state-item-count">42</span>
                  <span class="site-state-item-name">posts</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                <a href="/blog/categories/index.html">
                  <span class="site-state-item-count">11</span>
                  <span class="site-state-item-name">categories</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-tags">
                <a href="/blog/tags/index.html">
                  <span class="site-state-item-count">18</span>
                  <span class="site-state-item-name">tags</span>
                </a>
              </div>
            

          </nav>

          

          

          
          

          
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#观察者模式"><span class="nav-number">1.</span> <span class="nav-text">观察者模式</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Spring-EventListener"><span class="nav-number">2.</span> <span class="nav-text">Spring EventListener</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#需要避过的坑"><span class="nav-number">3.</span> <span class="nav-text">需要避过的坑</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2020</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">arry</span>

  
</div>


  <div class="powered-by">Powered by <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a></div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">Theme &mdash; <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Muse</a> v5.1.4</div>




        







        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  
    <script type="text/javascript" src="/blog/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  


  


  <script type="text/javascript" src="/blog/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/blog/js/src/motion.js?v=5.1.4"></script>



  
  

  
  <script type="text/javascript" src="/blog/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/blog/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/blog/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  












  





  

  

  

  
  

  

  

  

</body>
</html>
